Small cleanup in gtk_notebook_set_current_page and fix doc typo.
authorXan Lopez <xan@src.gnome.org>
Tue, 29 May 2007 22:13:42 +0000 (22:13 +0000)
committerXan Lopez <xan@src.gnome.org>
Tue, 29 May 2007 22:13:42 +0000 (22:13 +0000)
svn path=/trunk/; revision=17979

gtk/gtknotebook.c

index f7843cd4ec0c3c0bc383bd0fe3b621fd62b2a526..9b7dbe37b9a31e2cb9234371f855be76be3f42ba 100644 (file)
@@ -6247,7 +6247,7 @@ gtk_notebook_get_current_page (GtkNotebook *notebook)
 /**
  * gtk_notebook_get_nth_page:
  * @notebook: a #GtkNotebook
- * @page_num: the index of a page in the noteobok, or -1
+ * @page_num: the index of a page in the notebook, or -1
  *            to get the last page.
  * 
  * Returns the child widget contained in page number @page_num.
@@ -6355,13 +6355,10 @@ gtk_notebook_set_current_page (GtkNotebook *notebook,
 
   g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
 
-  if (page_num >= 0)
-    list = g_list_nth (notebook->children, page_num);
-  else
-    list = g_list_last (notebook->children);
-
-  page_num = g_list_index (notebook->children, list);
+  if (page_num < 0)
+    page_num = g_list_length (notebook->children) - 1;
 
+  list = g_list_nth (notebook->children, page_num);
   if (list)
     gtk_notebook_switch_page (notebook, GTK_NOTEBOOK_PAGE (list), page_num);
 }